package restaurant;

/**
 * The Command object to set the availability of a menu item.
 * 
 * @author Odessa
 */

public class cmdItemAvailability implements Command
{

	/** The information aggregator. */
	private InformationAggregator info;

	/** The item number of the item to add the number available for. */
	private int itemNo;

	/** The number of the item available. */
	private int numAvailable;



	/**
	 * Instantiates a new item availability command.
	 * 
	 * @param info the information aggregator.
	 * @param itemNo the item to set the number available for.
	 * @param numAvailable the number available of the item.
	 */
	public cmdItemAvailability(InformationAggregator info, int itemNo,
			int numAvailable) {
		this.info = info;
		this.itemNo = itemNo;
		this.numAvailable = numAvailable;
	}



	/**
	 * Sets the number of an item that is available.
	 * 
	 * @return null.
	 * @see restaurant.Command#execute()
	 */
	@Override
	public Object execute()
	{
		Menu menu = info.getMenu();
		menu.setItemAvailability(itemNo, numAvailable);

		return null;
	}

}
